package com.example.famhealing.schedule;

import java.util.ArrayList;

import com.example.famhealing.R;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.ImageButton;
import android.widget.ListView;
import android.widget.Spinner;
import android.widget.Toast;

public class DiagnoseFragment extends Fragment{

	ImageButton addDiagnose;
	
	private ArrayList<Diagnose_List_Data> Array_Data;
    private Diagnose_List_Data data;
    private DiagnoseListAdapter adapter;
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		
		View v = inflater.inflate(R.layout.fragment_diagnose, container, false);
		
		addDiagnose = (ImageButton)v.findViewById(R.id.addDiagnose);
		addDiagnose.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent = new Intent(getActivity(), AddDiagnoseActivity.class);
				startActivity(intent);
			}
			
		});
		
		
		//임시로 넣어놓은 데이터, 이후에는 파싱한 정보 입력
		Array_Data = new ArrayList<Diagnose_List_Data>();
        data = new Diagnose_List_Data("1/20", "09:00", "항암", "세브란스 병원");
        Array_Data.add(data);
        data = new Diagnose_List_Data("1/5", "19:00", "항암", "삼성병원");
        Array_Data.add(data);
        data = new Diagnose_List_Data("1/23", "09:00", "항암", "세브란스 병원");
        Array_Data.add(data);
       
        ListView diagnose_list = (ListView) v.findViewById(R.id.diagnose_List);
        adapter = new DiagnoseListAdapter(getActivity(), android.R.layout.simple_list_item_1, Array_Data);
        diagnose_list.setAdapter(adapter);
		
		return v;
	}
}
